package org.springframework.web.multipart;

import javax.servlet.http.HttpServletRequest;

/**
 *
 *
 *
 * MultipartResolver 用于处理文件上传，
 * 当收到请求时 DispatcherServlet 的 checkMultipart() 方法会调用 MultipartResolver 的 isMultipart() 方法判断请求中是否包含文件。
 * 如果请求数据中包含文件，则调用 MultipartResolver 的 resolveMultipart() 方法对请求的数据进行解析，然后将文件数据解析成 MultipartFile 并封装在 MultipartHttpServletRequest (继承了 HttpServletRequest) 对象中
 *
 */
public interface MultipartResolver {

	/**是否是 multipart
	 */
	boolean isMultipart(HttpServletRequest request);

	/**解析请求
	 */
	MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException;

	/**
	 * Cleanup any resources used for the multipart handling,
	 * like a storage for the uploaded files.
	 * @param request the request to cleanup resources for
	 */
	void cleanupMultipart(MultipartHttpServletRequest request);

}
